﻿@model CML.Intercamber.Business.Users
@{
    ViewBag.PageTitle = Resources.Intercamber.Login_ForgottenPassword;
}
@section PageHead
{
    <script type="text/javascript">
        $(function () {
            $("button").button();
            $("#ResetPwd").click(function () {
                $("#ResetPwd").hide();
                $("#loading").show();
                $.ajax({
                    type: "POST",
                    url: "/Account/SendForgottenPasswordLink",
                    contentType: "application/json; charset=utf-8",
                    data: "{'email':\"" + $("#email").val().replace("\"", "").replace("'", "") + "\"}",
                    dataType: "json",
                    success: function (result) {
                        $("#loading").hide();
                        if (result.ok) {
                            $("#errorMessage").html("");
                            $("#infoMessage").html(result.msg);
                            $("#loginDiv").hide();
                        } else {
                            $("#errorMessage").html(result.msg);
                            $("#infoMessage").html("");
                            $("#email").focus();
                            $("#ResetPwd").show();
                        }
                    },
                    error: function (result) {
                        $("#ResetPwd").show();
                        $("#loading").hide();
                        debugger;
                    }
                });
            });

        });

    </script>
    <style>
        .loginDiv
        {
            margin-top:120px;
            display:inline-block;
            text-align: center;
            padding: 30px;
            width: 600px;
            border: 1px solid gray;
            background-color: white;
        }
    </style>
}

@section PageContent {
    <div class="innerTitle ui-corner-all">
        @Resources.Intercamber.Login_ForgottenPassword
    </div>
    <br />
    <br />
    <div align="center" style="width:100%;">
        <div class="ui-corner-all loginDiv">
            @Resources.Intercamber.ForgottenPassword_HeadMessage
            <br/>
            <br/>
            <label id="errorMessage" style="color:red"></label>
            <label id="infoMessage" style="color:forestgreen"></label>
            <div id="loginDiv">
                @Resources.Intercamber.Login_Email 
                <input type="text" id="email" style="width: 200px;" value="" />
            </div>
            <br/>
            <br/>
            <button id="ResetPwd" onclick=""  class="" >@Resources.Intercamber.ForgottenPassword_SendNewPasswordLink</button>
            <img src="~/Images/Loading.gif" id="loading" style="display:none" />
        </div>
    </div>
}
